//FireBall
//https://www.shadertoy.com/view/llXGDN

uniform vec3      iResolution;           // viewport resolution (in pixels)
uniform float     iGlobalTime;           // shader playback time (in seconds)
uniform int       iGlobalFrame;          // shader playback frame
uniform float     iChannelTime[4];       // channel playback time (in seconds)
uniform vec3      iChannelResolution[4]; // channel resolution (in pixels)
uniform vec4      iMouse;                // mouse pixel coords. xy: current (if MLB down), zw: click
uniform samplerXX iChannel0..3;          // input channel. XX = 2D/Cube
uniform vec4      iDate;                 // (year, month, day, time in seconds)
uniform float     iSampleRate;           // sound sample rate (i.e., 44100)

void mainImage( out vec4 f, in vec2 w ) 
{
	vec2 r = iResolution.xy, p = (w-r*.5) / r.x;
    
	float d = length(p), c = 4.-d*9., k=1.;
    
	p = vec2(atan(p.x,p.y), d-iDate.w/4.)*.02;       
    
    for(int i=1; i<7; i++)
        c += texture2D(iChannel0, p).r / k, p += p, k += k;
    
	f = vec4(.3,.15,.1,1)*c*c;
}